package LayoutManager;

import java.awt.*;

public class BorderLayoutDemo {
    public static void main(String[] args) {
        Frame frame = new Frame("BorderLayout示例");
        frame.setBounds(100,100,400,300);
        frame.setLayout(new BorderLayout());

        Button btn1 = new Button("button1");
        Button btn2 = new Button("button2");
        Button btn3 = new Button("button3");
        Button btn4 = new Button("button4");
        Button btn5 = new Button("button5");

        btn1.setBackground(Color.RED);
        btn2.setBackground(Color.GREEN);
        btn3.setBackground(Color.BLUE);
        btn4.setBackground(Color.YELLOW);
        btn5.setBackground(Color.ORANGE);

        frame.add(btn1,BorderLayout.NORTH);
        frame.add(btn2,BorderLayout.SOUTH);
        frame.add(btn3,BorderLayout.EAST);
        frame.add(btn4,BorderLayout.WEST);
        frame.add(btn5,BorderLayout.CENTER);

        frame.setVisible(true);


    }
}
